package com.tongji;

import java.util.HashMap;
import java.util.Map;

import android.view.KeyEvent;

public class KeyMap
{
	final static int	NUM_COUNT			= 10;
	final static int	ALPHABET_COUNT		= 26;
	final static int	WIN_ZERO_KEY		= 0x30;
	final static int	WIN_A_KEY			= 0x41;
	final static int	WIN_ALT				= 0x12;
	final static int	WIN_APOSTROPHE		= 0xde;
	final static int	WIN_BACK			= 0x08;
	final static int	WIN_BACKSLASH		= 0xe2;
	final static int	WIN_COMMA			= 0xbc;
	final static int	WIN_RETURN			= 0x0d;
	final static int	WIN_LEFT_BRACKET	= 0xdb;
	final static int	WIN_RIGHT_BRACKET	= 0xdd;
	final static int	WIN_MINUS			= 0xbd;
	final static int	WIN_PERIOD			= 0xbe;
	final static int	WIN_PLUS			= 0xbb;
	final static int	WIN_SEMICOLON		= 0xba;
	final static int	WIN_LSHIFT			= 0xa0;
	final static int	WIN_RSHIFT			= 0xa1;
	final static int	WIN_SLASH			= 0xbf;
	final static int	WIN_SPACE			= 0x20;
	final static int	WIN_STAR			= 0x6a;
	final static int	WIN_TAB				= 0x09;

	public KeyMap()
	{
		super();
		{
			/**
			 * 0~9 A~Z
			 */
			for (int i = 0; i < NUM_COUNT; i++)
			{
				map.put(KeyEvent.KEYCODE_0 + i, WIN_ZERO_KEY + i);
			}
			for (int i = 0; i < ALPHABET_COUNT; i++)
			{
				map.put(KeyEvent.KEYCODE_A + i, WIN_A_KEY + i);
			}
		}
		map.put(KeyEvent.KEYCODE_ALT_LEFT, WIN_ALT);
		map.put(KeyEvent.KEYCODE_ALT_RIGHT, WIN_ALT);
		map.put(KeyEvent.KEYCODE_APOSTROPHE, WIN_APOSTROPHE);
		map.put(KeyEvent.KEYCODE_BACKSLASH, WIN_BACKSLASH);
		map.put(KeyEvent.KEYCODE_COMMA, WIN_COMMA);
		map.put(KeyEvent.KEYCODE_DEL, WIN_BACK);
		map.put(KeyEvent.KEYCODE_ENTER, WIN_RETURN);
		// map.put(KeyEvent.KEYCODE_EQUALS, WIN_ALT);// PLUS or EQUALS?
		map.put(KeyEvent.KEYCODE_PLUS, WIN_PLUS);
		map.put(KeyEvent.KEYCODE_LEFT_BRACKET, WIN_LEFT_BRACKET);
		map.put(KeyEvent.KEYCODE_RIGHT_BRACKET, WIN_RIGHT_BRACKET);
		map.put(KeyEvent.KEYCODE_MINUS, WIN_MINUS);
		map.put(KeyEvent.KEYCODE_PERIOD, WIN_PERIOD);
		map.put(KeyEvent.KEYCODE_SEMICOLON, WIN_SEMICOLON);
		map.put(KeyEvent.KEYCODE_SHIFT_LEFT, WIN_LSHIFT);
		map.put(KeyEvent.KEYCODE_SHIFT_RIGHT, WIN_RSHIFT);
		map.put(KeyEvent.KEYCODE_SLASH, WIN_SLASH);
		map.put(KeyEvent.KEYCODE_SPACE, WIN_SPACE);
		map.put(KeyEvent.KEYCODE_STAR, WIN_STAR);
		map.put(KeyEvent.KEYCODE_TAB, WIN_TAB);
	}

	private Map<Integer, Integer> map = new HashMap<Integer, Integer>();

	public Map<Integer, Integer> getMap()
	{
		return map;
	}

}
